User Guides > PCC with Legacy Services (Proxy Server) > How To's for PCC with Legacy Services (Proxy Server) > How To's - for the Flash Viewer > How to Redact a File > Implementing Redactions in the Web Tier |
The samples included in your installation do not include sample code for burning Redactions. However, the samples can serve as an excellent starting point to implementing the code examples below in order to fully support redactions.
Verify that you have all of the files needed in the settings.xml. The sample projects in the <Install path>/Samples/Plus folder have examples of the files as well as a working settings.xml file. For more information on settings.xml, refer to Configuring Flash Viewer Samples.
Optional Flash Parameters are provided to let you fully embed Prizm Content Connect Plus as a part of your application process, while customizing Redaction functionality to your users’ requirements.
See the full list of available Flash Parameters in the Developer Guide (API Reference) > Flash Viewer > Flash Vars. |
Your custom code needs to appear as ‘flashvars’ param variable so that it can be passed to the flash file at runtime.
Given below is an example with code showing various variables.
Copy Code
|
|
---|---|
<script src="jquery-1.4.2.min.js” language="javascript"></script> <script src="jquery.swfobject.1-1-1.min.js" language="javascript"></script> <script> documentviewer = $.flash.create( { swf: 'ViewerEnterprise.swf ', id:''ViewerEnterprise ', height: 600, width: 750, wmode: 'window', scale: 'noscale', allowFullScreen: true, allowScriptAccess: 'always', hasVersion: 10, hasVersionFail: function (options) { alert("You do not have required flash version"); }, encodeParams: false, bgcolor: '#ffffff', flashvars: { documentname: '<%=document %>', redactionReasons: 'Test Reason|New Reason|Confidential' } } ); $(document).ready( function () { $('#documentviewer').html(documentviewer); } ); </script> <div id="documentviewer"></div> |
The buttons that are specific to the Redact tab can be found in the Developer Guide (API Reference). They can be configured to be enabled or disabled by the developer.
If the viewer is not licensed for Redactions, the buttons will not be visible, even if the developer specifically chooses to enable them. |
Redactions that are manually created by the user can be burned onto the document when the user clicks on the ‘save’ button in the viewer.
Example |
Copy Code
|
---|---|
<settings> <conversionFileURL>convert.aspx</conversionFileURL> <getTotalPagesURL>gettotalpagecount.aspx</getTotalPagesURL> <getFastPagesURL>getfastpagecount.aspx</getFastPagesURL> <annotationsFilesURL>listmarkup.aspx</annotationsFilesURL> <annotationsOpenURL>openmarkup.aspx</annotationsOpenURL> <annotationsSaveURL>savemarkup.aspx</annotationsSaveURL> </settings> |
Sample ASP C# Code for savemarkup |
Copy Code
|
---|---|
// path to save the markups xml. This could be a temp location also string path2Save = Server.MapPath("markups\\"); // get document name from viewer string documentname= Request.Form["documentname"]; //get markup xml from viewer. This contains the markups to be burned string xml = Request.Form["annotations"]; //markup name of xml from viewer //markup name can be auto generated also, set saveAnnotationAs flash variable string markupName = Request.Form["annotationName"]; // path to save the xml string fileName = path2Save + Session["UniqueFileIdHash"] + "-" + markupName + ".xml"; //Write the xml StreamWriter sr = new StreamWriter(fileName); sr.WriteLine(xml); sr.Close(); //burn the xml to document to create a new pdf of document with xml burned in HttpWebRequest HttpWReq = (HttpWebRequest)WebRequest.Create("http://localhost:18680/convert2swf?source=" + originalDocument + "&target=" + targetPDFLocation) + "&redaction=" + fileName; HttpWebResponse HttpWResp = (HttpWebResponse)HttpWReq.GetResponse(); StreamReader sr = new StreamReader(HttpWResp.GetResponseStream(), System.Text.Encoding.UTF8); Response.Write("<root><saveAnnotationResponse saved='1'/></root>"); |
Sample PHP Code for savemarkup |
Copy Code
|
---|---|
<?php $uploaddir = "/var/www/html/samplecode-enterprise/"; $tempcachedir= "/var/www/html/samplecode-enterprise/temp/"; $path2Save ='markups/' ; $annotationName=$_POST['annotationName']; $xml=$_POST['annotations']; $document = $_POST['fileName']; $xmlfileName = $path2Save . $document . "_" . $annotationName . ".xml"; $fp = fopen($xmlfileName, 'w'); fwrite($fp, $xml); fclose($fp); # Burn the annotation to document $urlstring="http://localhost:18680/convert2swf?source=" . $uploaddir .$document. "&target=redacted_" . $ document.”.pdf&redaction=”.$xmlfileName; $redact=file_get_contents($urlstring); header("Content-Type: application/xml"); echo "<root><saveAnnotationResponse saved='1'/></root>"; flush(); ?> |